package allocator;

/**
 * Simple driver program that creates a single {@link MemoryAllocator} object.  This single memory allocator has a fixed
 * number of pages to allocate.
 * 
 *  The driver program creates a number of {@link PageRequestor} objects and passes them all a reference to the same memory allocator.
 *  The {@link PageRequestor} class is a {@link Runnable} object and is executed by a {@link Thread}
 *
 */
public class MemoryAllocatorDriver {
	
	private static int NUMBER_OF_PAGES = 1000;
	private static int NUMBER_OF_WORKER_THREADS = 10;

	/**
	 * @param args
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws InterruptedException {
		IMemoryAllocator allocator = new MemoryAllocator(NUMBER_OF_PAGES);
		
		for (int i = 0; i < NUMBER_OF_WORKER_THREADS; i++) {
			Thread worker = new Thread(new PageRequestor(allocator));
			worker.start();
		}
		
	}

}
